<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title></title>
  <link rel="stylesheet" href="../../assets/layui/css/layui.css" media="all"/>
  <link rel="stylesheet" href="../../assets/css/admin.css"/>
</head>
<body>
<div style="margin: 30px;">
  <form class="layui-form" action="" method="post" onsubmit="return false;">
    <div class="layui-form-item">
      <label class="layui-form-label"><span style="color: red">*</span>用户名称</label>
      <div class="layui-input-block">
        <input type="text" name="accountName" id="accountName"
               autocomplete="off" placeholder="请输入用户名称" class="layui-input" required>
      </div>
      <input type="hidden" name="accountId" id="accountId">
      <input type="hidden" name="type" id="type">
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label"><span style="color: red">*</span>交易平台</label>
      <div class="layui-input-block">
        <select name="platform" id="accountGroupId" required>
          <option value="asf">请选择</option>
          <option value="asf">okex</option>
          <option value="as">fcoin</option>
          <option value="afs">coinbene</option>
          <option value="fas">huobi</option>
          <option value="aaf">bitfinex</option>
        </select>
      </div>
    </div>
    <!-- <div class="layui-form-item">
        <label class="layui-form-label"><span style="color: red">*</span>充值金额</label>
        <div class="layui-input-block">
            <input type="text"name="amount" id="amount"  autocomplete="off" placeholder="请输入内容"
            class="layui-input" required></textarea>
        </div>
    </div> -->
    <div class="layui-form-item">
      <label class="layui-form-label"><span style="color: red">*</span>交易账号</label>
      <div class="layui-input-block">
        <input type="text" name="createby" id="accountTradeId" autocomplete="off"
               placeholder="请输入内容"
               class="layui-input" required></textarea>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label"><span style="color: red">*</span>交易密码</label>
      <div class="layui-input-block">
        <input type="text" name="secretkey" id="accountTradePasswd" autocomplete="off"
               placeholder="请输入内容"
               class="layui-input" required></textarea>
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn" lay-submit="" lay-filter="demo1">提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
      </div>
    </div>
  </form>
</div>
<script type="text/javascript" src="../../js/common/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../../assets/layui/layui.js"></script>
<script type="text/javascript"
        src="../../assets/plugins/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
<script type="text/javascript"
        src="../../assets/plugins/jquery-validation-1.14.0/lib/jquery.form.js"></script>
<script type="text/javascript"
        src="../../assets/plugins/jquery-validation-1.14.0/dist/localization/messages_zh.min.js"></script>
<script type="text/javascript" src="../../js/common/formUtil.js"></script>
<script type="text/javascript" src="../../js/common/commonUtil.js"></script>
<script type="text/javascript">
  layui.config({
    base: '../../assets/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'layer', 'form'], function () {
    var $ = layui.jquery,
        layer = layui.layer,
        form = layui.form;

    form.on('submit(demo1)', function (data) {

      getListData(data);

      ComUtil.closeParentLayer(function () {
      });
      //   return true; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
    });
    // console.log(path + "/a/setting/UserAction/saveUserInfo.do");

    // if (!ComUtil.isEmpty($("#accountId").val())) {

    /* if (ComUtil.isEmpty($("#accountId").val())) {
     ComUtil.AjaxData(null, "http://localhost:8080/api/configbasicinfos",
     function (obj, data) {
     console.log(data);
     FromEngine.jsonBindForm(obj, data.data);

     /!* if(data.data){
     groupId = data.data.accountGroupId;
     } *!/

     }, {
     accountId: $("#accountId").val()
     });
     }*/
    /* FromEngine.vsFrom(".layui-form", {
     debug: false,
     beforeSubmitFunction: function () {
     $("#type").val("<%=type%>");
     return true;
     },
     cfgUrlOrFunction: "http://localhost:8080/api/configbasicinfos",
     cfgCallBack: function (result) {

     ComUtil.closeParentLayer(function () {
     });
     }
     });
     */
  });

  function getListData(data) {
    console.log(data.field);
    $.ajax({
      type: 'POST',
      url: "http://localhost:8080/api/configuserkeys", // ajax请求路径
      data: JSON.stringify(data.field),
      dataType: 'json',
      header: {'Accept': 'application/json'},
      contentType: 'application/json',
      success: function (data) {
        console.log(data.length);

      }
    });
  };


</script>

</body>
</html>